package cc.vv.btpartyjob.partymanager.delegate

import android.view.View
import cc.vv.baselibrary.view.BaseTopBarView
import cc.vv.baselibrary.view.BtWebView
import cc.vv.baselibrary.view.WebProgressView
import cc.vv.btpartyjob.partymanager.R
import cc.vv.mvp.delegate.BaseAppDelegate
import com.tencent.smtt.export.external.interfaces.SslError
import com.tencent.smtt.export.external.interfaces.SslErrorHandler
import com.tencent.smtt.sdk.WebChromeClient
import com.tencent.smtt.sdk.WebView
import com.tencent.smtt.sdk.WebViewClient

/**
 * 楼栋党小组托管类
 * Created by Chen.qi on 2018/10/24.
 */
class LouDongTeamActivityDelegate : BaseAppDelegate() {


    override fun initWidget() {
    }

    override fun initLayoutRes(): Int {
        return R.layout.activity_loudong_team
    }

    /**设置标题title*/
    fun setTopBarTitle(topBarTitle: String) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_alt_topBar)
        titleBar?.setTitle(topBarTitle)
    }


    /**设置标题右边按钮点击事件*/
    fun setTitleBackBtnOnClick(event: BaseTopBarView.EventInterface) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_alt_topBar)
        titleBar?.setEventInterface(event)
    }


    fun initWebClient(webViewClient: WebViewClient, webCromeClient: WebChromeClient) {
        val webView = getView<BtWebView>(R.id.bwv_alt_webView)
        webView?.setWebViewClient(webViewClient)
        webView?.setWebChromeClient(webCromeClient)
    }

    fun getWebView(): BtWebView {
        return getView(R.id.bwv_alt_webView)
    }

    fun setWebViewUrl(webUrl: String) {
        val webView = getView<BtWebView>(R.id.bwv_alt_webView)
        webView?.loadUrl(webUrl)
    }


}